package com.pig4cloud.pig.admin.api.feign;

import com.bblocks.util.R;
import com.pig4cloud.pig.admin.api.entity.SysArea;
import com.pig4cloud.pig.admin.api.entity.SysDictItem;
import com.pig4cloud.pig.common.core.constant.ServiceNameConstants;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author Jin
 * @date 2024/5/12
 * <p>
 * 查询参数相关
 */
@FeignClient(contextId = "remoteAreaService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteAreaService {

	/**
	 * 根据ID获取
	 * @param id
	 * @return
	 */
	@GetMapping(value ="/area/details/{id}"/*,headers = {"Accept=application/x-kryo-serialization"}*/)
	R<SysArea> getById(@PathVariable("id") Long id);

	/**
	 * 根据code获取
	 * @param code
	 * @return
	 */
	@GetMapping(value="/area/detailsByCode/{code}"/*,headers = {"Accept=application/x-kryo-serialization"}*/)
	R<SysArea> getByCode(@PathVariable("code") String code);

	/**
	 * 根据父code获取
	 * @param parentCode 可以为空-则省份数据
	 * @return
	 */
	@GetMapping("/area/getByParentCode")
	R<List<SysArea>> getByParentCode(@RequestParam("parentCode") String parentCode);

	/**
	 * 内部调用-重新初始化区域数据
	 * @return
	 */
	@PutMapping("/area/initAll")
	R initAll();
}
